unit VDCtlMainUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TfrmVDCtrlMain = class(TForm)
    btnProtect: TBitBtn;
    btnUnprotect: TBitBtn;
    procedure btnProtectClick(Sender: TObject);
    procedure btnUnprotectClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmVDCtrlMain: TfrmVDCtrlMain;

implementation

uses DllImportUnit, VDCtrlPasswordUnit, FunctionUnit, ConstUnit;

{$R *.dfm}

procedure TfrmVDCtrlMain.btnProtectClick(Sender: TObject);
begin
  fcSetProtection( True );
end;

procedure TfrmVDCtrlMain.btnUnprotectClick(Sender: TObject);
begin
  fcSetProtection( False );
end;

procedure TfrmVDCtrlMain.FormCreate(Sender: TObject);
begin
  if ParamCount >= 1 then
  begin
    if FindCmdLineSwitch( EncryptString(RecoveProtect), ['-', '\', '/'], True) then
      btnProtect.Click;
    if FindCmdLineSwitch( EncryptString(RecoveUnprotect), ['-', '/', '\'], True) then
      btnUnprotect.Click;

    Application.Terminate;
    Exit;
  end;

  with TfrmVDCtrlPassword.Create(Self) do
  try
    if ShowModal <> mrOk then
      Application.Terminate;
  finally
    Free;
  end;

end;

end.
